Conditions | 2 |
Total Lines | 42 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
29 | |||
30 | @Put(':id') |
||
31 | @Roles(UserRole.PHOTOGRAPHER) |
||
32 | @ApiOperation({ summary: 'Update school' }) |
||
33 | public async index(@Param() idDto: IdDTO, @Body() dto: SchoolDTO) { |
||
34 | try { |
||
35 | const { |
||
36 | reference, |
||
37 | name, |
||
38 | address, |
||
39 | zipCode, |
||
40 | city, |
||
41 | phoneNumber, |
||
42 | email, |
||
43 | numberOfClasses, |
||
44 | numberOfStudents, |
||
45 | observation, |
||
46 | status, |
||
47 | type |
||
48 | } = dto; |
||
49 | |||
50 | const id = await this.commandBus.execute( |
||
51 | new UpdateSchoolCommand( |
||
52 | idDto.id, |
||
53 | reference, |
||
54 | name, |
||
55 | address, |
||
56 | zipCode, |
||
57 | city, |
||
58 | status, |
||
59 | type, |
||
60 | email, |
||
61 | phoneNumber, |
||
62 | numberOfStudents, |
||
63 | numberOfClasses, |
||
64 | observation |
||
65 | ) |
||
66 | ); |
||
67 | |||
68 | return { id }; |
||
69 | } catch (e) { |
||
70 | throw new BadRequestException(e.message); |
||
71 | } |
||
74 |